﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChartDataSet
{
    internal class Program
    {
        static async Task Main(string[] args)
        {
            // 创建图表对象
            Chart myChart = new Chart();

            // 设置图表属性
            myChart.ID = 1;
            myChart.Color = "绿色";
            myChart.ChartType = "柱形图";
            myChart.DataSet.Add(new DataItem("key1", 1.1));
            myChart.DataSet.Add(new DataItem("key2", 2.2));
            myChart.DataSet.Add(new DataItem("key3", 3.3));

            // 复制图表对象
            Chart clonedChart = myChart.Clone();
            clonedChart.DataSet[0] = new DataItem("key4", 4.4);
            clonedChart.DataSet[0] = new DataItem("key5", 5.5);
            clonedChart.DataSet[0] = new DataItem("key6", 6.6);
            // 修改新图表对象的属性
            clonedChart.ID = 2;

            // 显示原始图表
            await myChart.DisplayAsync();

            // 显示复制后的图表
            await clonedChart.DisplayAsync();

            Console.ReadKey();
        }
    }
}
